import Vue from "vue";
import VueRouter from "vue-router";
import { Lazyload } from "vant";
Vue.use(VueRouter);

Vue.use(Lazyload);
Vue.use(Lazyload, {
  lazyComponent: true,
});

// 注册时可以配置额外的选项
Vue.use(Lazyload, {
  lazyComponent: true,
});

const routes = [
  {
    path: "/",
    redirect: "/user/login",
  },
  // 首页
  {
    path: "/search",
    name: "search",
    component: () => import("../Search/search.vue"),
  },
  /* {
    path: "/favorite",
    name: "favorite",
    component: () => import("../views/favorite.vue"),
  }, */
  {
    path: "/user",
    name: "user",
    component: () => import("../views/user.vue"),
  },
  {
    path: "/user/login",
    name: "login",
    component: () => import("../views/login.vue"),
    meta: {
      hideTabBar: true,
    },
  },
  {
    path: "/user/register",
    name: "register",
    component: () => import("../views/register.vue"),
    meta: {
      hideTabBar: true,
    },
  },
  {
    path: "/user/checkCode",
    name: "checkCode",
    component: () => import("../views/checkCode.vue"),
  },
  {
    path: "/successLogin",
    name: "successLogin",
    component: () => import("../views/successLogin.vue"),
  },
  // 收藏歌曲列表
  {
    path: "/song-list",
    name: "SongList",
    component: () => import("../views/SongList.vue"),
  },
  // 播放页
  {
    path: "/play",
    name: "Play",
    component: () => import("../views/Play.vue"),
    meta: {
      hideTabBar: true,
    },
  },
  //
  {
    path: "/detail",
    name: "Detail",
    component: () => import("../Search/Detail"),
    meta: {
      hideTabBar: true,
    },
  },
  //
  {
    path: "/recommend",
    name: "Recommend",
    component: () => import("../Search/Recommend.vue"),
    meta: {
      hideTabBar: true,
    },
  },
  {
    path: "/mv",
    name: "mvList",
    component: () => import("../views/mvList.vue"),
  },
  {
    path: "/song-detail",
    name: "SongDetail",
    component: () => import("../views/SongDetail.vue"),
    meta: {
      hideTabBar: true,
    },
  },
];

const router = new VueRouter({
  routes,
});

export default router;
